package com.game.majiang.vo;

import java.util.ArrayList;
import java.util.HashMap;

import com.game.majiang.logic.LogicClient;

import lombok.Data;

@Data
public class Hongbao {

	public int uid;//发的玩家uid
	public String sendUserName;
	public ArrayList<Integer> listHongbao;//红包
	public ArrayList<Integer> listQianguid = new ArrayList<Integer>();//能抢红包的uid
	public HashMap<Integer, Integer> map;//《id,tableid》
	public int hongbaoid;//第几个
	public String roomName;
	public int difen;
	public int tableCount;
	public StringBuffer sendUserMessageStr ;
	public int allHongbaoMoney;
	public String uuid;
	public int surplusHongbaoMoney = 0;//剩余金额
	
	
	public void assignmentRoomName(int roomid) {
		String str = "";
		if (roomid == 3) {
			str = "丁二皇";
		} else if(roomid == 6) {
			str = "马鼓旋";
		}
		this.roomName =str;
	}
	
	
	public String qiangUserMessage(LogicClient client, int money) {
		
		String str = client.getVo().getNickName()+"("+client.getUserId()+")在"+this.roomName+this.difen+"皮"+
				this.map.get(client.getUserId())+"桌获"+this.sendUserName+"("+this.uid+")发的钻石红包"+money+"颗。";
		if (uid == 0) {
			str = client.getVo().getNickName()+"("+client.getUserId()+")在"+this.roomName+this.difen+"皮"+
					this.map.get(client.getUserId())+"桌获钻石红包"+money+"颗。";
		}
		return str;
		
	}
	
	public void sendUserMessage(LogicClient client, int money) {
		
		if (sendUserMessageStr == null) {
			sendUserMessageStr = new StringBuffer();
			sendUserMessageStr.append("#hongbao#"+this.sendUserName+"("+this.uid+")在"+this.roomName+this.difen+"皮共计"+this.tableCount+"桌,"+this.map.size()+"人已发"+
					this.allHongbaoMoney+"钻石红包。;");
		}
		//"+this.roomName+this.difen+"皮
		sendUserMessageStr.append(client.getVo().getNickName()+"("+client.getUserId()+")在<color=#00FF00FF>"+this.map.get(client.getUserId())+
				"</color>桌获钻石<color=#00FF00FF>"+money+"</color>颗。;");
				
	}
	
	public String getsendUserMessageStrValue() {
		
		if (sendUserMessageStr == null) {
			sendUserMessageStr = new StringBuffer();
			sendUserMessageStr.append("#hongbao#"+this.sendUserName+"("+this.uid+")在"+this.roomName+this.difen+"皮共计"+this.tableCount+"桌,"+this.map.size()+"人已发"+
					this.allHongbaoMoney+"钻石红包。;");
		}
		sendUserMessageStr.append(this.surplusHongbaoMoney);
		String str = sendUserMessageStr.toString();
//		if (str.endsWith(";")) {
//			str.substring(0, str.length()-1);
//		}
		return str;
		
	}
	
}
